-
Notifications
You must be signed in to change notification settings - Fork 904
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't require a full cython import to find PTX file #15785
Don't require a full cython import to find PTX file #15785
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this won't work for editable installs. The py files and the compiled extension modules are not side-by-side for the mode of editable installation we are using. The right way to make this work is to use importlib.resources
to get all of the file paths without loading the module, but that will require some work upstream in scikit-build-core to support that.
How are you currently performing an editable install? The PTX file locations aren't relative to any extension module, they should just be relative to the py files themselves. |
I'm doing an editable installation with The problem is that the PTX files are generated at build time and installed via CMake. When scikit-build-core does an editable install, anything that gets installed by CMake is placed into a directory in site-packages, while any pure Python files are read directly from the source directory (as would be expected with an editable install). Observe:
|
I see - if the cython extension modules are the only thing we can guarantee the location of in an editable install, I'd like to propose we ship some kind of empty cython module along with |
I guess it depends, what exactly is the problem that you're trying to solve? Is there a way to delay the set up of the PTX files until after you know cudf has been imported? That way you wouldn't have any need to import cudf prematurely. We could add a stub library, but I feel like that's going to be more trouble than it's worth. If we did move forward with that, you'd want to put a pyx file in core/udf with a function I've asked in scikit-build about how best to do this since I do think that's where work needs to be done to properly enable support. |
We're only reading from a PTX file because the version of CUDA used to compile it is needed to determine if MVC is necessary. This is the case where our package is compiled with CUDA V.X and the user has driver version V.Y, where X > Y. Unfortunately I think that means that we can't import cudf first, since later on in the cuDF import process we import |
While we're waiting to hear back re:scikit-build, maybe a try-except could do the trick as a patch too? I'm not sure that I see a way for the empty lib approach to work because just doing |
I did some more investigating on the skbuild side and followed up with scikit-build/scikit-build-core#807 and scikit-build/scikit-build-core#808. |
I'm going to close this since we should really be aiming to fix this upstream in scikit-build-core. |
We shouldn't need to do a full import of the cudf cython for the purposes of computing a relative path. It leads to awkward import errors when things go wrong that are misleading as to what cuDF is trying to actually do. Here I've deliberately removed the arrow lib to cause an error.
It also convolutes the purpose and effects of
_setup_numba
, which should aspire to configure numba independently of cuDF, and limits our ability to customize when and how we're importing the cython in cudf's main__init__
.With this PR, the error will now be:
Which feels a bit more natural and easy to diagnose as something being wrong with arrow.